package com.scau.meetingbook.service.impl;

import com.scau.meetingbook.pojo.RoomEquipment;
import com.scau.meetingbook.mapper.RoomEquipmentMapper;
import com.scau.meetingbook.service.RoomEquipmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.scau.meetingbook.vo.ResultVO;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;


import java.util.List;

@Service
public class RoomEquipmentServiceImpl extends ServiceImpl<RoomEquipmentMapper, RoomEquipment> implements RoomEquipmentService {

    @Autowired
    private RoomEquipmentMapper roomEquipmentMapper;

    @Override
    public ResultVO insertRoomEquipment(RoomEquipment roomEquipment) throws Exception {
        roomEquipmentMapper.insert(roomEquipment);
        return ResultVO.success(null);
    }

    @Override
    public ResultVO<RoomEquipment> getRoomEquipmentById(Integer id) throws Exception {
        return ResultVO.success(null, roomEquipmentMapper.selectById(id));
    }

    @Override
    public ResultVO updateRoomEquipmentById(RoomEquipment roomEquipment) throws Exception {
        roomEquipmentMapper.updateById(roomEquipment);
        return ResultVO.success(null);
    }

    @Override
    public ResultVO deleteRoomEquipmentById(Integer id) throws Exception {
        roomEquipmentMapper.deleteById(id);
        return ResultVO.success(null);
    }
}